<div class="layuimini-container layui-anim layui-anim-upbit">
    <div class="layuimini-main">
		<a class="layui-btn" data-content-href="private/fees/edit">新增</a>
        <table class="layui-hide" id="table" lay-filter="currentTableFilter"></table>
    </div>
</div>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit" data-content-href="private/fees/edit?id={{d.id}}">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" onclick="dell({{d.id}})">删除</a>
</script>
<script>
var form,table;
layui.use(['form','table'], function(){
  table = layui.table;
  form = layui.form;
	//第一个实例
  table.render({
	    elem: '#table'
	    ,url: '/private/fees/list' //数据接口
	    ,page: true //开启分页
	    ,cols: [[ //表头
	       {type: 'numbers', title: '序号', width:80}
	      ,{field: 'date', title: '缴费时间'}
	      ,{field: 'dict', title: '缴费类型',templet:  function(d){
		        return d.dict.name;
		  	} , width:200}
	      ,{field: 'money', title: '缴纳金额'}
	      ,{field: 'address', title: '缴纳地点'}
	      ,{field: 'remarks', title: '备注', width:150}
	      ,{title: '操作',toolbar: '#barDemo', width:150}
	    ]]
	  });
});
var dell = function(id){
	if(confirm(" 确定删除吗？")){
		$.ajax({
			url:'/private/fees/dell',
			type:'POST',
			dataType:'json',
			data:{id:id},
			success:function(obj){
				layer.alert(obj.message);
				if(obj.success){
					table.reload('table',null);
				}
			}
		});
	}
}
</script>